home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
bipl.zip
/
PROCS.ZIP
/
FEVAL.ICN
< prev
next >
Wrap
Text File
|
1992-11-20
|
1KB
|
57 lines
############################################################################
#
# File: feval.icn
#
# Subject: Procedure to evaluate string as function call
#
# Author: Ralph E. Griswold
#
# Date: June 29, 1990
#
###########################################################################
#
# This procedure analyzes a string representing an Icon function or
# procedure call and evaluates the result.
#
# It assumes the string is well-formed. The arguments can only be
# Icon literals. Escapes, commas, and parentheses in strings literals
# are not handled.
#
############################################################################
#
# Links: ivalue
#
############################################################################
link ivalue
procedure feval(s)
local fnc, argl
s ? {
fnc := getfnc()
argl := []
while put(argl,getarg())
suspend fnc!argl
}
end
#
# Get an argument. This procedure is naive and could be improved.
#
procedure getarg()
return 1(ivalue(tab(upto(',)'))), move(1))
end
#
# Get the function name. Could be extended.
#
procedure getfnc()
return 1(tab(upto('(')), move(1))
end